﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ContinuousMacro.CApCMCreateContinuousMacroCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.ContinuousMacro.Resources;
using EngineeringInternalExtension;
using System;
using System.Windows;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.ContinuousMacro;

public class CApCMCreateContinuousMacroCmd : TxButtonCommand
{
  private CApCMCreateContinuousMacroEnabler enabler;
  private CUiCMContinuousMacroDlg form;

  public CApCMCreateContinuousMacroCmd() => this.enabler = new CApCMCreateContinuousMacroEnabler();

  public virtual string Category => ContinuousMacroResources.CMD_CATEGORY;

  public virtual string Name => ContinuousMacroResources.CREATE_CONTINUOUS_MACRO;

  public virtual string Tooltip => ContinuousMacroResources.CMD_TOOLTIP_CREATE_COMMAND;

  public virtual string Bitmap => "ContinuousMacro.Resources.CreateContinuousMacro.bmp";

  public virtual string LargeBitmap => "ContinuousMacro.Resources.CreateContinuousMacro_LARGE.png";

  public virtual string Description => ContinuousMacroResources.CMD_DESCRIPTION_CREATE_COMMAND;

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.enabler;

  public virtual bool Connect() => true;

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("CreateMacro");

  public virtual void Execute(object cmdParams)
  {
    if (!TxCommandLicenser.CreateContinuousMacroLicense)
    {
      TxMessageBoxEx.ShowNoLicenseError(base.Name);
    }
    else
    {
      this.form = new CUiCMContinuousMacroDlg(CApCMContinuousMacroUtilities.GetSelectedViaLocation((Func<TxRoboticViaLocationOperation, bool>) (x => !CApCMMacroShape.ViaContainsMacro(x))), CApCMMacroShape.Create(CApCMShape.Rectangle, (ITxLocatableObject) null, 100.0, 100.0), false);
      ((Window) this.form).Show();
    }
  }
}
